﻿@model SIG.ViewModel.Admin.EmailSetVM
@{
    ViewBag.Title = "邮箱服务设置";
    ViewBag.PageTitle = ViewBag.Title + "_常规设置";

}


<div class="main-content">
    @using (Ajax.BeginForm("EditEmailSet", null, new AjaxOptions()
            {
                OnSuccess = "onSuccess",
                OnBegin = "onBegin",
                OnComplete = "onComplete"

            }, new { @class = "form-horizontal", role = "form" }))
            {
        <div class="panel panel-default">
            <div class="panel-heading">
                <span class="glyphicon glyphicon-envelope"></span> @ViewBag.Title
            </div>
            <div class="panel-body">


                @Html.AntiForgeryToken()
                @Html.ValidationSummary(false)


                <div class="form-group">
                    @Html.LabelFor(model => model.From, new { @class = "col-md-2 control-label" })
                    <div class="col-md-5">
                        @Html.TextBoxFor(model => model.From, new { @class = "form-control", placeholder = "电子邮箱" })
                    </div>
                    <div class="col-md-5">
                        @Html.ValidationMessageFor(model => model.From)
                    </div>
                </div>

                <div class="form-group">
                    @Html.LabelFor(model => model.SmtpServer, new { @class = "col-md-2 control-label" })
                    <div class="col-md-5">
                        @Html.TextBoxFor(model => model.SmtpServer, new { @class = "form-control", placeholder = "SMTP服务器" })
                    </div>
                    <div class="col-md-5">
                        @Html.ValidationMessageFor(model => model.SmtpServer)
                    </div>
                </div>

                <div class="form-group">
                    @Html.LabelFor(model => model.Port, new { @class = "col-md-2 control-label" })
                    <div class="col-md-5">
                        @Html.TextBoxFor(model => model.Port, new { @class = "form-control", placeholder = "端口" })
                    </div>
                    <div class="col-md-5">
                        @Html.ValidationMessageFor(model => model.Port)
                    </div>
                </div>

                <div class="form-group">
                    @Html.LabelFor(model => model.UserName, new { @class = "col-md-2 control-label" })
                    <div class="col-md-5">
                        @Html.TextBoxFor(model => model.UserName, new { @class = "form-control", placeholder = "用户名" })
                    </div>
                    <div class="col-md-5">
                        @Html.ValidationMessageFor(model => model.UserName)
                    </div>
                </div>


                <div class="form-group">
                    @Html.LabelFor(model => model.Password, new { @class = "col-md-2 control-label" })
                    <div class="col-md-5">
                        @Html.PasswordFor(model => model.Password, new { @class = "form-control", placeholder = "密码" })
                    </div>
                    <div class="col-md-5">
                        @Html.ValidationMessageFor(model => model.Password)
                    </div>
                </div>

                <div class="form-group">
                    @Html.LabelFor(model => model.EnableSsl, new { @class = "col-md-2 control-label" })
                    <div class="col-md-5">
                        <div class="checkbox">
                            <label>
                                @Html.EditorFor(model => model.EnableSsl)
                            </label>
                        </div>
                        @Html.ValidationMessageFor(model => model.EnableSsl)
                    </div>
                </div>

            </div>
            <footer class="panel-footer text-right">
                <input type="submit" id="btnSave" class="btn btn-primary" value="保存" />
            </footer>
        </div>

    }
</div>

@section footer {
    @Scripts.Render("~/bundles/jqueryvalWithBootstrap")
    <script>
        function onBegin() {
            $("#btnSave i").removeClass("fa-save").addClass("fa-spinner fa-spin")
        }
        function onComplete() {
            $("#btnSave i").removeClass("fa-spinner fa-spin").addClass("fa-save")
        }
        function onSuccess(data) {
        Common.ShowBox(data.Status, data.Message, "@ViewBag.Title");
        //  debugger;
    }
    </script>
}